-- TouchDemo.lua
-- Author: Mikael Kindborg
-- Date: 2011-02-22
-- Description: Very simple demo of touch events in Lua.

function DrawObject(x, y)
  -- Draw background.
  maSetColorRGB(0, 0, 255)
  maFillRect(0, 0, Screen.getWidth(), Screen.getHeight())
  -- Draw a square object.
  maSetColorRGB(0, 255, 0)
  maFillRect(x - 50, y - 50, 100, 100)
  -- Redraw screen.
  maUpdateScreen()
end

System.onTouchDown(DrawObject)
-- System.onTouchDrag(DrawObject)

-- Initial display.
DrawObject(50, 50)
